#include <iostream>
using namespace std;

/*
    cin是istream类的对象
        >> 抽取运算符
    抽取运算符重载：istream & operator>>(istream &cin,T &val);
        函数调用:cin.operator>>(n1);
*/
struct Student
{
    int id;
    char name[20];
    double score;
};
class Cat
{
public:
    Cat(int _age = 0, string _name = "")
    {
        age = _age;
        name = _name;
    }
    friend istream &operator>>(istream &cin, Cat &val);
    friend ostream &operator<<(ostream &cout, Cat &val);

private:
    int age;
    string name;
};

istream &operator>>(istream &cin, Student &val)
{
    cin >> val.id >> val.name >> val.score;
    cout << "学生id:" << val.id << "学生名字:" << val.name << "学生成绩:" << val.score << endl;
    return cin;
}
istream &operator>>(istream &cin, Cat &val)
{
    cin >> val.age >> val.name;
    return cin;
}

ostream &operator<<(ostream &cout, Cat &val)
{
    cout << "猫的年龄是:" << val.age << " 猫的名字是:" << val.name << endl;
    return cout;
}

int main()
{
    Student s1;
    cin >> s1;
    Cat c1,c2;
    cin >> c1;
    cin >> c2;
    cout << c1 << c2;

    return 0;
}